﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

namespace ApplLogic.ApplClasses
{
    [Serializable]
    public class ApplShift
    {
        private string m_Id;
        private string m_Name;
        private int m_NumberOfWorkersNeeded;
        private DateTime m_BeginTime;
        private DateTime m_EndTime;

        public string Id 
        {
            get { return m_Id; }
            set { m_Id = value; } 
        }
        public string Name 
        {
            get { return m_Name; }
            set { m_Name = value; } 
        }
        public int NumberOfWorkersNeeded 
        {
            get { return m_NumberOfWorkersNeeded; }
            set { m_NumberOfWorkersNeeded = value; } 
        }

        public DateTime BeginTime
        {
            get { return m_BeginTime; }
            set { m_BeginTime = value; }
        }

        public DateTime EndTime
        {
            get { return m_EndTime; }
            set { m_EndTime = value; }
        }

        public ApplShift DeepClone()
        {
            MemoryStream ms = new MemoryStream();
            BinaryFormatter bf = new BinaryFormatter();
            bf.Serialize(ms, this);
            ms.Position = 0;
            ApplShift obj = (ApplShift)bf.Deserialize(ms);
            ms.Close();
            return obj;
        }

        public override string ToString()
        {
            return
                string.Format("\n Shift Name: {0}\n Id: {1}\n Id: {2}\n NumberOfWorkersNeeded: {3}\n BeginTime: {4}\n EndTime{5}\n"
                              , m_Name, m_Id, m_NumberOfWorkersNeeded, m_BeginTime.ToShortDateString(), m_EndTime.ToShortDateString());
        }
             
    }
}
